package com.ifeng.stock;

import java.util.*;

public class Main implements Runnable{

	private static boolean printcode = true;
	private static boolean printname = true;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		if(args.length != 0 && args.length != 1 ){
			System.out.println("Usage:\r\n -c : print code only \r\n -n : print name only\r\n");
			return;
		}
		else if(args.length == 1){
			if(args[0].equalsIgnoreCase("-n")){
				printcode=false;
			}
			else if(args[0].equalsIgnoreCase("-c")){
				printname=false;
			}
		}
		Main s = new Main();
		Thread polling = new Thread(s);
		polling.start();
	}

	
	public void run(){
		while(true){
			try {
				System.out.println("=========================================================");
				System.out.println(new Date());
				System.out.println("=========================================================");
				com.ifeng.stock.Reader.go(printcode, printname);
				com.dingniu8.Reader.go(printcode, printname);
				
				Thread.sleep(1000*20);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	

	
	
}
